                                                                                            
package util.AST.Expressao;

import checker.SemanticException;
import checker.Visitor;
import util.AST.Terminal.OpRel;

public class ExpressaoRel  extends Expressao{
	
	private String tipo;
	private ExpressaoAriPrimaria expAriPriEsq;
	private OpRel opRel;
	private ExpressaoAriPrimaria expAriPriDir;
	
	public ExpressaoRel(ExpressaoAriPrimaria expAriPriEsq, OpRel opRel,ExpressaoAriPrimaria expAriPriDir){
	
		this.expAriPriEsq = expAriPriEsq;
		this.opRel = opRel;
		this.expAriPriDir = expAriPriDir;
	}
	
	public ExpressaoRel(){
	}
	
	
	public ExpressaoAriPrimaria getExpRelPriEsq(){
		return this.expAriPriEsq;
	}
	
	public OpRel getOpRel(){
		return this.opRel;
	}

	public ExpressaoAriPrimaria getExpRelPriDir(){
		return this.expAriPriDir;
	}

	public String toString(int level) {
		int nextLevel = level+5;
		StringBuffer str = new StringBuffer();
		str.append("ExpRel\n");
		if ( this.expAriPriEsq != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expAriPriEsq.toString(nextLevel));
		}
		if ( this.opRel != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.opRel.toString(nextLevel));
		}
		if ( this.expAriPriDir != null ) {
			str.append(super.getSpaces(nextLevel) + "|-" + this.expAriPriDir.toString(nextLevel));
		}
		return str.toString();

	}

	@Override
	public Object visit(Visitor v, Object o) throws SemanticException {
		return v.visitExpressaoRel(this, o);
	}

	public String getTipo() {
		return tipo;
	}

	public void setTipo(String tipo) {
		this.tipo = tipo;
	}
}
	